package cn.kent.factoryMethodPattern;

/**
 * 女娲
 *
 * @author kent
 * @date 2021/5/8 15:01
 */
public class NvWa {
    public static void main(String[] args) {
        // 女娲第一次造人，不够熟练，没烤熟，缺陷产品--出来白人
        System.out.println("造出来第一批人=====白人");
        Human whiteHuman = HumanFactory.createHuman(WhiteHuman.class);
        whiteHuman.cry();
        whiteHuman.laugh();
        whiteHuman.talk();

        // 烧过了，出来黑人
        System.out.println("造出来第二批人=====黑人");
        Human blackHuman = HumanFactory.createHuman(BlackHuman.class);
        blackHuman.cry();
        blackHuman.laugh();
        blackHuman.talk();

        System.out.println("造出来第三批人=====黄人");
        Human yellowHuman = HumanFactory.createHuman(YellowHuman.class);
        yellowHuman.laugh();
        yellowHuman.cry();
        yellowHuman.talk();

        // 女娲烦躁了，爱是啥人种就是啥人种，烧吧
        for (int i = 0; i < 100; i++) {
            System.out.println("====随机产生人种" + i + "====");
            Human human = HumanFactory.createHuman();
            human.cry();
            human.laugh();
            human.talk();
        }


        // map改造
        System.out.println("造出来第三批人=====黄人");
        Human yeHuman = HumanFactoryTwo.createHuman(YellowHuman.class);
        yeHuman.laugh();
        yeHuman.cry();
        yeHuman.talk();
    }
}
